import Vue from 'vue'
import {isHttp} from './tools'
Vue.prototype.$showToast=(title='请输入内容',duration=2000)=>uni.showToast({
  title,
  duration,
  icon:'none'
});
Vue.prototype.$hideToast=()=>uni.hideToast();
Vue.prototype.$navigateTo=url=>{
  return uni.navigateTo({ url})
};
Vue.prototype.$navigateBack=(delta=1)=>uni.navigateBack({
  delta
});
Vue.prototype.$showLoading=(data={})=>{
  const {title,mask,success,fail} =data
  uni.showLoading({
    title:title || '请求中...',
    mask:mask||true,
    success,
    fail
  });
}
Vue.prototype.$hideLoading=(timeout=3000)=>{
  setTimeout(function () {
    uni.hideLoading();
  }, timeout || 2000);
}
Vue.prototype.$imageUrl=process.uniEnv.imageUrl
Vue.prototype.$isHttp=isHttp //是否有http https开着
//打电话
Vue.prototype.$onMakePhoneCall=(phoneNumber)=>{
  uni.makePhoneCall({
    phoneNumber
  });
}
